package office.word.docx4j;

import com.documents4j.api.DocumentType;
import com.documents4j.api.IConverter;
import com.documents4j.job.LocalConverter;

import java.io.FileInputStream;
import java.io.FileOutputStream;

/**
 * 参考
 *  - docx4j官网：https://www.docx4java.org/trac/docx4j
 *  - openxml标准：http://officeopenxml.com/WPparagraph.php
 * @author zhanglu
 * @project JavaBase
 * @description
 * @date 2023/6/12 16:51
 */
public class Docx4jTest {

    public static void main(String[] args) throws Exception {
        String excelFile = "/Users/zhanglu/Desktop/tmp/docx4j/source.xls";
        String pdfFile = "/Users/zhanglu/Desktop/tmp/docx4j/1.pdf";
        IConverter converter = LocalConverter.builder().build();
        converter.convert(new FileInputStream(excelFile))
                .as(DocumentType.XLS)
                .to(new FileOutputStream(pdfFile)).as(DocumentType.PDF).execute();

    }

}
